// pages/my/components/head/head.js
const app = getApp();
var WxNotificationCenter = require("../../../../config/WxNotificationCenter");

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    userInfo: {
      type: Object,
      value: {}
    }
  },
  /*组件所在页面的生命周期 */
  pageLifetimes: {
    show: function () {
      // let that = this;
      // WxNotificationCenter.addNotification("loginsuccess", that.getuserinfo, that);
      // this.getuserinfo();
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    hasUserInfo: false,
    canIUseGetUserProfile: false
  },

  /**
   * 组件的方法列表
   */
  methods: {
    getuserinfo() {

      let userInfo = app.globalData.userInfo;
      if (userInfo) {
        this.setData({
          userInfo: userInfo,
          userName: userInfo.name
        })
      }
      console.log('userInfo:', this.data.userInfo)
    },


  }
})